import { request } from '@gui-pkg/request';

enum Api {
  AllMonitorData = '/api/gq/onemap/getAllStcdAndMonitorData', // 所有站点数据
  DemonstrateMonitorData = '/api/gq/onemap/getAllStcdAndMonitorData?params%5Bdemozone_id%5D=1', // 示范区内站点数据
  AllStationData = '/api/gq/baseinfo/station/list?typeArr=SN,SZ,BZ,HZ,RR,CZ,WQ,WSK', // 点位接口
  TianDiInfo = '/api/gq/baseinfo/farmland/gis/rel', // 田地详情
  getVideoPlayUrl = "/api/gq/st/video/list" //获取播放地址
}

// 所有站点数据
export function getAllMonitorData() {
  return request.get({ url: Api.AllMonitorData });
}

// 示范区内站点数据
export function getDemonstrateMonitorData() {
  return request.get({ url: Api.DemonstrateMonitorData });
}

// 所有点位数据
export function getAllStationData() {
  return request.get({ url: Api.AllStationData });
}

// 获取田地详情
export function getFieldInfo(name: string) {
  return request.get({ url: Api.TianDiInfo, params: { name: name } });
}

export const getVideoPlayUrl = (params) => {
  let { videoStcd } = params
  let url = `${Api.getVideoPlayUrl}/${videoStcd}`
  return request.get({ url });
}
